﻿using System;
using Prompts.Service.PromptService.Implementation;
using Prompts.Service.Properties;

namespace Prompts.Service.PromptService.Construction
{
    public class ChildPromptLevelServiceInjector
    {
        public static IChildPromptLevelService Inject()
        {
            return new ChildPromptLevelService(InjectHierarchyPromptService());
        }

        private static IHierarchyPromptService InjectHierarchyPromptService()
        {
            return new HierarchyPromptService(InjectPromptReportParameterService()
                , InjectHiearchyPromptProvider());
        }

        private static IHierarchyPromptProvider InjectHiearchyPromptProvider()
        {
            return new HierarchyPromptProvider();
        }

        private static IPromptReportParameterService InjectPromptReportParameterService()
        {
            return new PromptReportParameterService(
                InjectPromptReportServceFolder(),
                ReportExecutionServiceInjector.Inject(),
                InjectPromptReportNameParser());
        }

        private static IPromptReportNameParser InjectPromptReportNameParser()
        {
            return new PromptReportNameParser();
        }

        private static IReportServerFolder InjectPromptReportServceFolder()
        {
            var folderPath = Settings.Default.Prompt_Report_Folder;
            return new ReportServerFolder(folderPath);
        }
    }
}